log using "BadasJustusMillionaire", t

use BadasJustusMillionaireYouGOV.dta 

///: Summary statistics for number of Js who are millionaires. Figure 1
graph hbar, over(J_Millionaire)


/// M1 Favors wealthy. OLS. Table 1 model 1 
reg Favors_Wealthy J_Millionaire  IdeoDistance FollowCourt ///
CourtKnow b3.pid3 b3.ideo5 high_earner Male educ white ageg  [pweight = weight]


///: Figure 2, panel 1 
margins, at(J_Millionaire=(0(1)9))
marginsplot, title(Millionaire Justices and Perceptions that Court Favors Wealthy) plot1opts(color(black)msymbol(none) lwidth(medthick) ///
xtitle(Number of Millionaire Justices) ytitle("Predicted Agreement" "Court Favors Wealthy")) ///
recastci(rarea)  ///
ciopts(color(gs10%85)alwidth(none)) ///
addplot(hist J_Millionaire, fcolor(gs1%30) lwidth(none) ///
percent ///
yaxis(2) ///
yscale(alt lcolor(gs10) axis(2)) ///
ylabel(0 "0%" 15 "15%" 30 "30%" 150 " "  , /// 
labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(small)) /// 
ytitle(" ", axis(2)) /// 
xlabel(0(1)9) ///
legend(off))



///: M2 Gibson legitimacy. OLS. Table 1 model 2. 
reg GibsonLegit J_Millionaire IdeoDistance FollowCourt ///
CourtKnow b3.pid3 b3.ideo5 high_earner Male educ white ageg  [pweight = weight]

///: Figure 2, panel 2. 
margins, at(J_Millionaire=(0(1)9))
marginsplot, title(Millionaire Justices and Legitimacy: Gibson Index) plot1opts(color(black)msymbol(none) lwidth(medthick) ///
xtitle(Number of Millionaire Justices) ytitle("Predicted Legitimacy" "Gibson Index")) ///
recastci(rarea)  ///
ciopts(color(gs10%85)alwidth(none)) ///
addplot(hist J_Millionaire, fcolor(gs1%30) lwidth(none) ///
percent ///
yaxis(2) ///
yscale(alt lcolor(gs10) axis(2)) ///
ylabel(0 "0%" 15 "15%" 30 "30%" 150 " "  , /// 
labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(small)) /// 
ytitle(" ", axis(2)) /// 
xlabel(0(1)9) ///
legend(off))




///: M3 Applied Legitimacy. OLS. Table 1 model 3 
reg AppliedLegit J_Millionaire IdeoDistance FollowCourt ///
CourtKnow b3.pid3 b3.ideo5 high_earner Male educ white ageg [pweight = weight] 

///: Figure 3, panel 3.
margins, at(J_Millionaire=(0(1)9)) 
marginsplot, title(Millionaire Justices and Legitimacy: Applied Index) plot1opts(color(black)msymbol(none) lwidth(medthick) ///
xtitle(Number of Millionaire Justices) ytitle("Predicted Legitimacy" "Gibson Index")) ///
recastci(rarea)  ///
ciopts(color(gs10%85)alwidth(none)) ///
addplot(hist J_Millionaire, fcolor(gs1%30) lwidth(none) ///
percent ///
yaxis(2) ///
yscale(alt lcolor(gs10) axis(2)) ///
ylabel(0 "0%" 15 "15%" 30 "30%" 150 " "  , /// 
labcolor() axis(2) tlcolor(black) tlwidth(thin) labsize(small)) /// 
ytitle(" ", axis(2)) /// 
xlabel(0(1)9) ///
legend(off))


clear

use BadasJustusMillionaireConjoint.dta

///: Conjoint analyses 
   ///: These analyses require the conjoint package to be installed
ssc install conjoint 

   ///: Support for Nominee. Figure 4
   conjoint support Net_worth J*, est(mm) h0(2.40) id(ID) graph
         conjoint support Net_worth , est(mm) h0(2.40) id(ID) graph
   ///: Fairness of Nominee. Figure 3
   conjoint fair Net_worth J*, est(mm) h0(2.99) id(ID) graph
      conjoint fair Net_worth , est(mm) h0(2.99) id(ID) graph
	
clear 


log close
